package com.iman.sumer.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "drm_quiz_student")
public class QuizStudent implements Serializable{
	// `id`,  `course_id`,  `title`,  LEFT(`content`, 256),  `create_dt`,  `quiz_uid`,  `view_cnt`,  `del_yn`,  `update_dt`,  `answer_cnt`
	@Id
	@GenericGenerator(name = "paymentableGenerator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
	private long quizId;
	
	@Column(name = "course_id")
	private Long courseId;
	@Column(name = "title")
	private String title;
	@Column(name = "content")
	private String content ;
	@Column(name = "create_dt")
	private Date createDate;
	@Column(name = "quiz_uid")
	private long quizUid;
	@Column(name = "view_cnt")
	private int viewCnt;
	@Column(name = "del_yn")
	private int delYn;
	@Column(name = "update_dt")
	private Date updateDate;
	@Column(name = "answer_cnt")
	private int answerCnt;
	
	public long getQuizId() {
		return quizId;
	}
	public void setQuizId(long quizId) {
		this.quizId = quizId;
	}
	public Long getCourseId() {
		return courseId;
	}
	public void setCourseId(Long courseId) {
		this.courseId = courseId;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public long getQuizUid() {
		return quizUid;
	}
	public void setQuizUid(long quizUid) {
		this.quizUid = quizUid;
	}
	public int getViewCnt() {
		return viewCnt;
	}
	public void setViewCnt(int viewCnt) {
		this.viewCnt = viewCnt;
	}
	public int getDelYn() {
		return delYn;
	}
	public void setDelYn(int delYn) {
		this.delYn = delYn;
	}
	public Date getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
	public int getAnswerCnt() {
		return answerCnt;
	}
	public void setAnswerCnt(int answerCnt) {
		this.answerCnt = answerCnt;
	}
	@Override
	public String toString() {
		return "QuizStudent [quizId=" + quizId + ", courseId=" + courseId
				+ ", title=" + title + ", content=" + content + ", createDate="
				+ createDate + ", quizUid=" + quizUid + ", viewCnt=" + viewCnt
				+ ", delYn=" + delYn + ", updateDate=" + updateDate
				+ ", answerCnt=" + answerCnt + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + answerCnt;
		result = prime * result + ((content == null) ? 0 : content.hashCode());
		result = prime * result + (int) (courseId ^ (courseId >>> 32));
		result = prime * result
				+ ((createDate == null) ? 0 : createDate.hashCode());
		result = prime * result + delYn;
		result = prime * result + (int) (quizId ^ (quizId >>> 32));
		result = prime * result + (int) (quizUid ^ (quizUid >>> 32));
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result
				+ ((updateDate == null) ? 0 : updateDate.hashCode());
		result = prime * result + viewCnt;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		QuizStudent other = (QuizStudent) obj;
		if (answerCnt != other.answerCnt)
			return false;
		if (content == null) {
			if (other.content != null)
				return false;
		} else if (!content.equals(other.content))
			return false;
		if (courseId != other.courseId)
			return false;
		if (createDate == null) {
			if (other.createDate != null)
				return false;
		} else if (!createDate.equals(other.createDate))
			return false;
		if (delYn != other.delYn)
			return false;
		if (quizId != other.quizId)
			return false;
		if (quizUid != other.quizUid)
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (updateDate == null) {
			if (other.updateDate != null)
				return false;
		} else if (!updateDate.equals(other.updateDate))
			return false;
		if (viewCnt != other.viewCnt)
			return false;
		return true;
	}
}
